function houseManage(id) {
	var url = "/IMS/house/showList.ht?cid=" + id + "&pcid=" + pcid;
	$.go(url, {
		dataType : 'html',
		beforeSend : function() {
			showProccessBar();
		},
		error : function() {
			hideProccessBar();
		},
		success : function(data, textStatus) {
			replaceDocument(url, data);
		}
	});
}

function ownerManage(id) {
	var url = "/IMS/owner/showList.ht?communityId=" + id + "&pcid=" + pcid;
	$.go(url, {
		dataType : 'html',
		beforeSend : function() {
			showProccessBar();
		},
		error : function() {
			hideProccessBar();
		},
		success : function(data, textStatus) {
			replaceDocument(url, data);
		}
	});
}

$(function() {
	// 展开更多
	(function() {
		$(".icip_btn_more").delegate(".icip_more_show", "mouseover", function() {
			$(this).parents('.icip_btn_more').addClass("icip_active");
		});

		$(".icip_btn_more").on("mouseout", function(evt) {
			if (!$(this).find(evt.relatedTarget)[0]) {
				$(this).removeClass("icip_active");
			}
		});
	})();
});

function delComm(cid) {
	_confirm("<span style='color:#FE6600'>是否删除当前记录</span>", function() {
		var _url = '/IMS/community/delComm.ht';
		_url = _url + "?id=" + cid;
		$.ajax({
			type : 'post',
			async : false,
			url : _url,
			dataType : 'json',
			beforeSend : function() {
				showProccessBar();
			},
			error : function() {
				hideProccessBar();
			},
			success : function(value) {
				var code = value.code;
				if (code == message_success_code) {
					var listUrl = "/IMS/community/showList.ht?companyId=" + pcid;
					$.go(listUrl, {
						dataType : 'html',
						error : function() {
							hideProccessBar();
						},
						success : function(data, textStatus) {
							replaceDocument(listUrl, data);
						}
					});
				} else {
					_alert(value.msg);
					hideProccessBar();
					return;
				}
			}
		});
	});
}

function editComm(id, hcount, pcount, pcid_, flag) {
	var url = "/IMS/community/showBaseInfo.ht?cid=" + id + "&hcount=" + hcount + "&pcount=" + pcount + "&pcid=" + pcid_;
	$.go(url, {
		dataType : 'html',
		beforeSend : function() {
			showProccessBar();
		},
		error : function() {
			hideProccessBar();
		},
		success : function(data, textStatus) {
			replaceDocument(url, data);
		}
	});
}

function showUploadPage() {
	hideProccessBar();
}

function batchAdd() {
	if ($("#uploadFile")) {
		$.submit($("#uploadForm"), {
			dataType : 'json',
			beforeSend : function() {
				showProccessBar();
			},
			error : function() {
				hideProccessBar();
			},
			success : function(data, textStatus) {
				if (data.code == '1') {
					_alert("导入失败 " + data.message);
				} else {
					_alert("导入成功", function() {
						if (data.result) {
							$("#downlandFile").attr("href", '/IMS/community/downlandResult.ht?batchId=' + data.result);
							$("#downland_li").show();
						}
					});
				}
				hideProccessBar();
			}
		});
	} else {
		_alert("请选择上传文件");
	}
}

function searchSubmit() {
	/*
	var selectSearch = $("#select2-s_province-container").text();
	var search = $("#search").val();
	if (selectSearch == '请选择省份' && !search) {
		_alert("请选择查询条件后再搜索");
		return;
	}
	*/
	$.submit($('#frm'), {
		dataType : 'html',
		beforeSend : function() {
			showProccessBar();
		},
		error : function() {
			hideProccessBar();
		},
		success : function(data, textStatus) {
			var url = $('#frm').attr('action');
			replaceDocument(url, data);
		}
	});
}